﻿/*

  The contents of this file are subject to the Mozilla Public License Version
  1.1 (the "License"); you may not use this file except in compliance with
  the License. You may obtain a copy of the License at 
  
           http://www.mozilla.org/MPL/ 
  
  Software distributed under the License is distributed on an "AS IS" basis,
  WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  for the specific language governing rights and limitations under the License. 
  
  The Original Code is AST'r Framework.
  
  The Initial Developer of the Original Code is
  ALCARAZ Marc (aka eKameleon) <vegas@ekameleon.net>.
  Portions created by the Initial Developer are Copyright (C) 2004-2007
  the Initial Developer. All Rights Reserved.
  
  Contributor(s) :
  
 */

import ewhiteboard.vo.ShapeVO;

import vegas.events.BasicEvent;

/**
 * The {@code ShapeEvent} to dispatch an event with a ShapeVO inside.
 * @author eKameleon
 */
class ewhiteboard.events.ShapeEvent extends BasicEvent 
{
	
	/**
	 * Creates a new ShapeEvent instance.
	 * @param type the string type of the instance.
	 * @param shape The ShapeVO of the instance. 
	 * @param target the target of the event.
	 * @param context the optional context object of the event.
	 * @param bubbles indicates if the event is a bubbling event.
	 * @param eventPhase the current EventPhase of the event.
	 * @param time this parameter is used in the Eden deserialization.
	 * @param stop this parameter is used in the Eden deserialization.
	 */
	public function ShapeEvent(type:String, shape:ShapeVO, target, context, bubbles:Boolean, eventPhase:Number, time:Number, stop:Number) 
	{
		super(type, target, context, bubbles, eventPhase, time, stop);
		if ( shape != null )
		{
			this.shape = shape ;
		}
	}
	
	/**
	 * The shape value object reference of this event.
	 */
	public var shape:ShapeVO ;

	/**
	 * Creates and returns a shallow copy of this instance.
	 * @return a shallow copy of the object.
	 */
	public function clone() 
	{
		return new ShapeEvent(getType(), getShape(), getTarget(), getContext()) ;
	}
	
	/**
	 * Returns the array instance.
	 * @return the array instance.
	 */
	public function getShape():ShapeVO
	{
		return this.shape ;	
	}
	
	/**
	 * Register the object to be use in the AMF exchange of datas.
	 */
	public static function register( id:String ):Void
	{
		Object.registerClass( id || "ShapeEvent" , ShapeEvent ) ;
	}
	
	/**
	 * Sets the array instance.
	 */
	public function setShape(shape:ShapeVO):Void
	{
		this.shape = shape ;	
	}


}